package com.xiaolin.structure.tree.common;

import com.xiaolin.structure.tree.node.Node;

/**
 * @ClassName BinaryTree
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/11/17
 * @Version 1.0
 */
public class BinaryTreeTest<E> {
    public static void main(String[] args) {
        BinaryTree<BinaryTree.Student> binaryTree=new BinaryTree<>();
        BinaryTree.Student student=new BinaryTree.Student(1,"小林");
        BinaryTree.Student s2=new BinaryTree.Student(2,"小红");
        BinaryTree.Student s3=new BinaryTree.Student(3,"小北");
        BinaryTree.Student s4=new BinaryTree.Student(4,"小兰");
        BinaryTree.Student s5=new BinaryTree.Student(5,"小绿");
        Node<BinaryTree.Student> root=new Node<>(student,1);
        root.setLeft(new Node<>(s2,2));
        root.setRight(new Node<>(s3,3));
        root.getLeft().setLeft(new Node<>(s4,4));
        root.getLeft().setRight(new Node<>(s5,5));
        binaryTree.setRoot(root);
        System.out.println("---前序");
        binaryTree.preTraverse();
        System.out.println("---中序");
        binaryTree.midTraverse();
        System.out.println("---后序");
        binaryTree.afterTraverse();
    }
}
